#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+10;
inline void Freopen(){
	freopen("replace.in","r",stdin);
	freopen("replace.out","w",stdout);
}
int n,q;
string s[MAXN];
signed main(){
	Freopen();
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>q;
	for(int i=1;i<=n;i++) cin>>s[i];
	while(q--){
		string t; cin>>t;
		cout<<0<<'\n';
	}
	return 0;
}

